<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">
		<meta charset="UTF-8">
		<meta name="apple-mobile-web-app-capable" content="yes"/>
	    <meta name="full-screen" content="true"/>
	    <meta name="screen-orientation" content="portrait"/>
	    <meta name="x5-fullscreen" content="true"/>
	    <meta name="360-fullscreen" content="true"/>
		<title>葡萄干——福袋</title>
		<link rel="stylesheet" type="text/css" href="css/public.css"/>
		<link rel="stylesheet" type="text/css" href="css/style.css"/>
	</head>

	<body style="position: absolute;" id="yemian">
		<div class="page_div">
			<div class="page1">
				<img class="sy_bg1" src="image/shouye/sy_bg1.jpg"/>
				<div class="sy_lihua"></div>
				<div class="sy_bg2">
					<div class="sy_shu"></div>
					<div class="sy_hongbao"></div>
				</div>
				<div class="sy_logo"></div>
				<div class="sy_deng"></div>
				<div class="sy_wenzi"></div>
				
				
				<img class="sy_mengban" src="image/shouye/sy_mengban.png"/>
				<div class="xiahua huadong"></div>
			</div>
			<div class="page2" style="display: none;">
				<img class="cj_bg" src="image/choujiang/cj_bg.jpg"/>
				<div class="cj_fugai"></div>
				
				<div class="cj_lihua"></div>
				
				<div class="cj_logo"></div>
				<div class="cj_deng"></div>
				<div class="cj_shu"></div>
				
				
				<div class="cj_daizi">
					<div class="cj_putaogan"></div>
					<div class="cj_fudai">
						<div class="cj_fu1"></div>
						<div class="cj_fu2"></div>
						<div class="cj_fu3"></div>
						<div class="cj_fu4"></div>
						<div class="cj_fu5"></div>
						<div class="cj_fu6"></div>
					</div>
					
				</div>
				<div class="cj_wenzi">
					<div class="cj_btn_cjsm"></div>
				</div>
				<div class="cj_sm_div">
					<div class="cj_choujiangshuoming">
						<div class="cj_close" onclick="$('.cj_sm_div').hide()"></div>
					</div>
				</div>
			</div>
			<div class="page3" style="display: none;">
				<div class="jiangpin1" style="display: none;">
					<div class="jg_zhufuyu">
						<div class="zhufuyu_div">
							<img src=""/>
						</div>
						<div class="zhufuyu_close" onclick="$('.jiangpin1').hide();tiaozhuan()"></div>
					</div>
				</div>
				<div class="jiangpin2" style="display: block;">
					<div class="jg_msg">
						<div>
							<img class="jg_jiangpin abs_center" src="image/jieguo/jg_putaogan.png"/>
						</div>
						<div class="user_info">
							<input type="text" name="" id="xingming" value="" placeholder="姓名"/>
							<input type="text" name="" id="dianhua" value="14323455434" placeholder="联系电话"/>
							<input type="text" name="" id="dizhi" value="" placeholder="填写地址"/>
						</div>
						<div class="msg_close" onclick="$('.jiangpin2').hide();tiaozhuan();"></div>
						<div class="tijiao"></div>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
<script src="js/jquery-2.1.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/jweixin-1.0.0.js"></script>
<script src="js/fenxiang.js"></script>
<script type="text/javascript">
	var openid = $.cookie("openid");
	if(openid=="" || openid==null){
		location.href = encodeURI("fabu.html");
	}
	$.post("shuju.php?jieshou=checkopenid",{openid:openid},function(text){
		if(text=="0"){
			location.href = encodeURI("fabu.html");
		}
	})
	$(function(){
		$(".cj_btn_cjsm").click(function(){
			$(".cj_sm_div").show()
		})
		$(".cj_fudai>div").click(function(){
			$.post("shuju.php?jieshou=choujiang",{openid:openid},function(text){
				if(text=="1"){
					alert("已经抽过奖了！");
				}
				if(text=="zhufu"){
					$(".page2,.jiangpin2").hide();$(".page3,.jiangpin1").show();
				}
				if(text=="putaogan"){
					$(".jg_jiangpin").attr("src","image/jieguo/jg_putaogan.png")
					$(".page2,.jiangpin1").hide();$(".page3,.jiangpin2").show();
				}
				if(text=="rili"){
					$(".jg_jiangpin").attr("src","image/jieguo/jg_rili.png")
					$(".page2,.jiangpin1	").hide();$(".page3,.jiangpin2").show();
				}
			})
		})
		$(".tijiao").click(function(){
			var xingming = $("#xingming").val();
			var dianhua =  $("#dianhua").val();
			var dizhi = $("#dizhi").val();
			if(xingming==""){
				alert("姓名不能为空");
				return;
			}
			if(dizhi==""){
				alert("地址不能为空");
				return;
			}
			if(dianhua.length!=11 || dianhua=="" || dianhua.substr(0,1)!="1"){
				alert("请输入正确的电话号码！");
				return;
			}
			$.post("shuju.php?jieshou=tijiao",{openid:openid,xingming:xingming,dianhua:dianhua,dizhi:dizhi},function(text){
				if(text=="1"){
					alert("提交成功！");
					$(".page3").hide();$(".page1").show();
				}
			})
			
			try {
				var image1 = "http://www.jkera.cn/raisin_lucky/image/share.jpg";
				var url1 = "http://www.jkera.cn/raisin_lucky/index.html";
				fenxiang("葡萄干福袋分享朋友主标题","葡萄干福袋分享朋友副标题", "葡萄干福袋分享朋友圈主标题", url1, image1, name);
			} catch(err) {
			}
		})
		function tiaozhuan(){
			$(".page3").hide();$(".page1").show();
		}
	})
</script>
<script src="js/resLoader.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var loader = new resLoader({
	     resources : [
	          'image/shouye/logo.png',

	     ],
	     onStart : function(total){
	          console.log('start:'+total);
	     },
	     onProgress : function(current, total){
	          console.log(current+'/'+total);
	          var percent =parseInt(current/total*100);
//	          $('.loading_jindutiao').css('width', percent+'%');
	     },
	     onComplete : function(total){
	     }
	});

	loader.start();
</script>

<script src="js/touch-0.2.14.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var index = 1;
	$(".page_div").on("touchstart", function(e) {
	    	// 判断默认行为是否可以被禁用
	    if (e.cancelable) {
	        // 判断默认行为是否已经被禁用
	        if (!e.defaultPrevented) {
//	            e.preventDefault();
	        }
	    }   
	    startX = e.originalEvent.changedTouches[0].pageX,
	    startY = e.originalEvent.changedTouches[0].pageY;
	});
	$(".page_div").on("touchend", function(e) {         
	    // 判断默认行为是否可以被禁用
	    if (e.cancelable) {
	        // 判断默认行为是否已经被禁用
	        if (!e.defaultPrevented) {
//	            e.preventDefault();
	        }
	    }               
	    moveEndX = e.originalEvent.changedTouches[0].pageX,
	    moveEndY = e.originalEvent.changedTouches[0].pageY,
	    X = moveEndX - startX,
	    Y = moveEndY - startY;
	    if ( Y > 100) {
//	        alert('下滑');   
			if(index==1){
//				$(".page1").hide();$(".page2").show();
			}
			
//			if(index==3){
//				$(".page2").show();$(".page3").hide();
//				index -= 1;return;
//			}
//			if(index == 4){
//				$(".page3").show();$('.page4').hide();
//				index -= 1;return;
//			}
			if(index==1){
				$(".page1").hide();$(".page2").show();
				index += 1;return;
			}
	    }
	    //上滑
	    else if ( Y < -100 ) {
//	        alert('上滑');   
			if(index==2){
				$(".page1").show();$(".page2").hide();
				index -= 1;return;
			}
//			if(index==2){
//				$(".page2").hide();$(".page3").show();
//				index += 1;return;
//			}
//			if(index==3){
//				$(".page3").hide();$(".page4").show();
//				index += 1;
//				return;
//			}
//			if(index == 4){
//				
//			}
			
	    }
//	    //左滑
//	    if ( X > 0 ) {
////	        alert('左滑');  
//	    }
//	    //右滑
//	    else if ( X < 0 ) {
////	        alert('右滑'); 
//	    }
//	    //下滑
//	    else if ( Y > 0) {
//	        alert('下滑');    
//	    }
//	    //上滑
//	    else if ( Y < 0 ) {
//	        alert('上滑');    
//	    }
//	    //单击
//	    else{
////	        alert('单击');    
//	    }
	});
</script>